<?php
/*
 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
 * Copyright (C) 2002-2012 The Nucleus Group
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * (see nucleus/documentation/index.html#license for more info)
 */
/**
 * Class representing a skin
 *
 * @license http://nucleuscms.org/license.txt GNU General Public License
 * @copyright Copyright (C) 2002-2012 The Nucleus Group
 * @version $Id: skinableSKIN.php 163 2012-02-13 04:17:40Z shizuki17xx $
 * @version $NucleusJP: SKIN.php,v 1.8.2.1 2007/09/05 07:45:01 kimitake Exp $
 */

if ( !function_exists('requestVar') ) exit;
//require_once dirname(__FILE__) . '/ACTIONS.php';
require_once dirname(__FILE__) . '/skinableACTIONS.php';

class skinableSKIN
{

    // after creating a SKIN object, evaluates to true when the skin exists
    public $isValid;

    // skin characteristics. Use the getXXX methods rather than accessing directly
    public $id;
    public $description;
    public $contentType;
    public $includeMode;       // either 'normal' or 'skindir'
    public $includePrefix;
    public $name;

    function __construct($id) {
        $this->id = intval($id);

        // read skin name/description/content type
        $que = 'SELECT '
             . '    * '
             . 'FROM '
             .      sql_table('adminskin_desc') . ' '
             . 'WHERE '
             . '    sdnumber = %d';
        $res = sql_query(sprintf($que, $this->id));
        $obj = sql_fetch_object($res);
        $this->isValid = (sql_num_rows($res) > 0);

        if (!$this->isValid) {
            return;
        }

        $this->name          = $obj->sdname;
        $this->description   = $obj->sddesc;
        $this->contentType   = $obj->sdtype;
        $this->includeMode   = $obj->sdincmode;
        $this->includePrefix = $obj->sdincpref;

    }

    function getID()
    {
        return $this->id;
    }

    function getName()
    {
        return $this->name;
    }

    function getDescription()
    {
        return $this->description;
    }

    function getContentType()
    {
        return $this->contentType;
    }

    function getIncludeMode()
    {
        return $this->includeMode;
    }

    function getIncludePrefix()
    {
        return $this->includePrefix;
    }

    /**
     * Checks if a skin with a given shortname exists
     * @param string $name Skin short name
     * @return int number of skins with the given ID
     * @static
     */
    function exists($name)
    {
        $query = 'SELECT '
               . '    COUNT(*) as result '
               . 'FROM '
               .      sql_table('adminskin_desc') . ' '
               . 'WHERE '
               . '    sdname = "%s"';
        return quickQuery(sprintf($query, sql_real_escape_string($name))) > 0;
    }

    /**
     * Checks if a skin with a given ID exists
     * @param string $id Skin ID
     * @return int number of skins with the given ID
     * @static
     */
    function existsID($id)
    {
        $query = 'SELECT '
               . '    COUNT(*) as result '
               . 'FROM '
               .      sql_table('adminskin_desc') . ' '
               . 'WHERE '
               . '    sdnumber = %d';
        return quickQuery(sprintf($query, intval($id))) > 0;
    }

    /**
     * Returns a skin given its shortname
     * @param string $name Skin shortname
     * @return object SKIN
     * @static
     */
    function createFromName($name)
    {
        return new skinableSKIN(skinableSKIN::getIdFromName($name));
    }

    /**
     * Returns a skin ID given its shortname
     * @param string $name Skin shortname
     * @return int Skin ID
     * @static
     */
    function getIdFromName($name) {
        $query =  'SELECT sdnumber'
               . ' FROM '.sql_table('adminskin_desc')
               . ' WHERE sdname="' . sql_real_escape_string($name) . '"';
        $res = sql_query($query);
        $obj = sql_fetch_object($res);
        return $obj->sdnumber;
    }

    /**
     * Returns a skin shortname given its ID
     * @param string $name
     * @return string Skin short name
     * @static
     */
    function getNameFromId($id) {
        $query = 'SELECT '
               . '    sdname as result '
               . 'FROM '
               .      sql_table('adminskin_desc') . ' '
               . 'WHERE '
               . '    sdnumber = %d';
        return quickQuery(sprintf($query, intval($id)));
    }

    /**
     * Creates a new skin, with the given characteristics.
     *
     * @static
     */
    function createNew($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '') {
        global $manager;

        $manager->notify(
            'PreAddAdminSkin',
            array(
                'name'          => &$name,
                'description'   => &$desc,
                'type'          => &$type,
                'includeMode'   => &$includeMode,
                'includePrefix' => &$includePrefix
            )
        );

        $query = 'INSERT '
               . 'INTO '
               .      sql_table('adminskin_desc') . ' '
               . '('
               . '    sdname, '
               . '    sddesc, '
               . '    sdtype, '
               . '    sdincmode, '
               . '    sdincpref'
               . ') VALUES ('
               . '    "%s", '
               . '    "%s", '
               . '    "%s", '
               . '    "%s", '
               . '    "%s" '
               . ')';
        $sdname    = sql_real_escape_string($name);
        $sddesc    = sql_real_escape_string($desc);
        $sdtype    = sql_real_escape_string($type);
        $sdincmode = sql_real_escape_string($includeMode);
        $sdincpref = sql_real_escape_string($includePrefix);
        sql_query(sprintf($query, $sdname, $sddesc, $sdtype, $sdincmode, $sdincpref));
        $newid = sql_insert_id();

        $manager->notify(
            'PostAddAdminSkin',
            array(
                'skinid'        => $newid,
                'name'          => $name,
                'description'   => $desc,
                'type'          => $type,
                'includeMode'   => $includeMode,
                'includePrefix' => $includePrefix
            )
        );
        return $newid;
    }

    function parse($type)
    {
        global $manager, $CONF;

        if ($type == 'pagehead') {
            $manager->notify(
                'InitAdminSkinParse',
                array(
                    'skin' => &$this->adminSkin,
                    'type' => $type
                )
            );
            // set output type
            sendContentType($this->adminSkin->getContentType(), 'skin', _CHARSET);
        }

        // set skin name as global var (so plugins can access it)
        global $currentAdminSkinName;
        $currentAdminSkinName = $this->getName();
        $contents             = $this->getContent($type);
        if (!$contents) {
            // use base skin if this skin does not have contents
            $defskin = new skinableSKIN($CONF['DefaultAdminSkin']);
            $contents = $defskin->getContent($type);
            if (!$contents) {
                echo _ERROR_SKIN;
                return;
            }
        }

        $actions = $this->getAllowedActionsForType($type);

        $manager->notify(
            'PreAdminSkinParse',
            array(
                'skin'     => &$this,
                'type'     => $type,
                'contents' => &$contents
            )
        );

        // set IncludeMode properties of parser
        PARSER::setProperty('IncludeMode',$this->getIncludeMode());
        PARSER::setProperty('IncludePrefix',$this->getIncludePrefix());

        $handler = new skinableACTIONS($type, $this, $calledClass);
        $parser  = new PARSER($actions, $handler);
        $handler->setParser($parser);
        $handler->setSkin($this);
        $parser->parse($contents);

        if ($type == 'pagefoot') {
            $manager->notify(
                'PostAdminAdminSkinParse',
                array(
                    'skin' => &$this->adminSkin,
                    'type' => $type,
                )
            );
        }
    }

    function getContent($type)
    {
        $query = 'SELECT '
               . '    scontent '
               . 'FROM '
               .      sql_table('adminskin') . ' '
               . 'WHERE '
               . '    sdesc = %d '
               . 'and stype = "%s"';
        $res   = sql_query(sprintf($query, $this->id, sql_real_escape_string($type)));

        if (sql_num_rows($res) == 0) {
            return '';
        } else {
            return sql_result($res, 0, 0);
        }
    }

    /**
     * Updates the contents of one part of the skin
     */
    function update($type, $content)
    {
        $skinid = $this->id;
        // delete old thingie
        $query = 'DELETE '
               . 'FROM '
               .      sql_table('adminskin') . ' '
               . 'WHERE '
               . '    stype = "%s" '
               . 'and sdesc = %d';
        sql_query(sprintf($query, sql_real_escape_string($type), intval($skinid)));

        // write new thingie
        if ($content) {
            $query = 'INSERT '
                   . 'INTO '
                   .      sql_table('adminskin') . ' '
                   . 'SET '
                   . '    scontent = "%s", '
                   . '    stype    = "%s", '
                   . '    sdesc    = %d';
        sql_query(sprintf($query, sql_real_escape_string($content), sql_real_escape_string($type), intval($skinid)));
        }
    }

    /**
     * Deletes all skin parts from the database
     */
    function deleteAllParts()
    {
        $query = 'DELETE '
               . 'FROM '
               .      sql_table('adminskin') . ' '
               . 'WHERE '
               . '    sdesc = %d';
        sql_query(sprintf($query, $this->getID()));
    }

    /**
     * Updates the general information about the skin
     */
    function updateGeneralInfo($name, $desc, $type = 'text/html', $includeMode = 'normal', $includePrefix = '')
    {
        $query = 'UPDATE '
               .      sql_table('adminskin_desc') . ' '
               . 'SET '
               . '    sdname    = "%s", '
               . '    sddesc    = "%s", '
               . '    sdtype    = "%s", '
               . '    sdincmode = "%s", '
               . '    sdincpref = "%s" '
               . 'WHERE '
               . '    sdnumber = %d';
        $sdname    = sql_real_escape_string($name);
        $sddesc    = sql_real_escape_string($desc);
        $sdtype    = sql_real_escape_string($type);
        $sdincmode = sql_real_escape_string($includeMode);
        $sdincpref = sql_real_escape_string($includePrefix);
        sql_query(sprintf($query, $sdname, $sddesc, $sdtype, $sdincmode, $sdincpref, $this->getID()));
    }
    /**
     * static: returns an array of default skin types
     */
    static public function getAdminskinDefaultTypes()
    {
        return array(
            'showlogin',                        'login',                            'overview',
            'itemlist',                         'blogcommentlist',                  'bookmarklet',
            'blogsettings',                     'banlist',                          'deleteblog',
            'editmembersettings',               'browseownitems',                   'browseowncomments',
            'createitem',                       'itemedit',                         'itemmove',
            'categoryedit',                     'categorydelete',                   'manage',
            'actionlog',                        'settingsedit',                     'backupoverview',
            'pluginlist',                       'createnewlog',                     'usermanagement',
            'skinoverview',                     'templateoverview',                 'skinieoverview',
            'itemcommentlist',                  'commentedit',                      'commentdelete',
            'banlistdelete',                    'itemdelete',                       'manageteam',
            'teamdelete',                       'adminskinedit',                    'banlistnew',
            'memberedit',                       'memberdelete',                     'pluginhelp',
            'pluginoptions',                    'plugindelete',                     'skinedittype',
            'skinremovetype',                   'skindelete',                       'skinedit',
            'templateedit',                     'templatedelete',                   'activate',
            'systemoverview',                   'activatesetpwd',                   'adminskinoverview',
            'addnewlog',                        'adminerrorpage',                   'backuprestore',
            'banlistdeleteconfirm',             'batchcategory',                    'batchcomment',
            'batchdelete',                      'batchitem',                        'batchmember',
            'batchmove',                        'batchteam',                        'blogselectbox',
            'skiniedoimport',                   'insertpluginoptions',              'pagefoot',
            'pagehead',                         'skinieimport',                     'adminskindelete',
            'adminskinedittype',                'adminskiniedoimport',              'adminskinieimport',
            'adminskinieoverview',              'admintemplateoverview',            'adminskinremovetype',
            'admintemplateedit',                'admintemplatedelete',

        );
    }

    /**
     * static: returns an array of default skin type's friendly names
     */
    static public function getAdminskinDefaultTypeFriendlyNames()
    {
        return array(
            'showlogin'             => _ADM_SKPRT_SHOWLOGIN,
            'adminskinedit'         => _ADM_SKPRT_ADMINSKINEDIT,
            'overview'              => _ADM_SKPRT_OVERVIEW,
            'itemlist'              => _ADM_SKPRT_ITEMLIST,
            'blogcommentlist'       => _ADM_SKPRT_BLOGCOMMENTLIST,
            'bookmarklet'           => _ADM_SKPRT_BOOKMARKLET,
            'blogsettings'          => _ADM_SKPRT_BLOGSETTINGS,
            'banlist'               => _ADM_SKPRT_BANLIST,
            'deleteblog'            => _ADM_SKPRT_DELETEBLOG,
            'editmembersettings'    => _ADM_SKPRT_EDITMEMBERSETTINGS,
            'browseownitems'        => _ADM_SKPRT_BROWSEOWNITEMS,
            'browseowncomments'     => _ADM_SKPRT_BROWSEOWNCOMMENTS,
            'createitem'            => _ADM_SKPRT_CREATEITEM,
            'itemedit'              => _ADM_SKPRT_ITEMEDIT,
            'itemmove'              => _ADM_SKPRT_ITEMMOVE,
            'categoryedit'          => _ADM_SKPRT_CATEGORYEDIT,
            'categorydelete'        => _ADM_SKPRT_CATEGORYDELETE,
            'manage'                => _ADM_SKPRT_MANAGE,
            'actionlog'             => _ADM_SKPRT_ACTIONLOG,
            'settingsedit'          => _ADM_SKPRT_SETTINGSEDIT,
            'backupoverview'        => _ADM_SKPRT_BACKUPOVERVIEW,
            'pluginlist'            => _ADM_SKPRT_PLUGINLIST,
            'createnewlog'          => _ADM_SKPRT_CREATENEWLOG,
            'usermanagement'        => _ADM_SKPRT_USERMANAGEMENT,
            'skinoverview'          => _ADM_SKPRT_SKINOVERVIEW,
            'templateoverview'      => _ADM_SKPRT_TEMPLATEOVERVIEW,
            'skinieoverview'        => _ADM_SKPRT_SKINIEOVERVIEW,
            'itemcommentlist'       => _ADM_SKPRT_ITEMCOMMENTLIST,
            'commentedit'           => _ADM_SKPRT_COMMENTEDIT,
            'commentdelete'         => _ADM_SKPRT_COMMENTDELETE,
            'banlistdelete'         => _ADM_SKPRT_BANLISTDELETE,
            'skiniedoimport'        => _ADM_SKPRT_SKINIEDOIMPORT,
            'itemdelete'            => _ADM_SKPRT_ITEMDELETE,
            'manageteam'            => _ADM_SKPRT_MANAGETEAM,
            'teamdelete'            => _ADM_SKPRT_TEAMDELETE,
            'banlistnew'            => _ADM_SKPRT_BANLISTNEW,
            'memberdelete'          => _ADM_SKPRT_MEMBERDELETE,
            'pagehead'              => _ADM_SKPRT_PAGEHEAD,
            'pluginhelp'            => _ADM_SKPRT_PLUGINHELP,
            'pluginoptions'         => _ADM_SKPRT_PLUGINOPTIONS,
            'plugindelete'          => _ADM_SKPRT_PLUGINDELETE,
            'skinedittype'          => _ADM_SKPRT_SKINEDITTYPE,
            'skinremovetype'        => _ADM_SKPRT_SKINREMOVETYPE,
            'skindelete'            => _ADM_SKPRT_SKINDELETE,
            'skinedit'              => _ADM_SKPRT_SKINEDIT,
            'templateedit'          => _ADM_SKPRT_TEMPLATEEDIT,
            'templatedelete'        => _ADM_SKPRT_TEMPLATEDELETE,
            'activate'              => _ADM_SKPRT_ACTIVATE,
            'systemoverview'        => _ADM_SKPRT_SYSTEMOVERVIEW,
            'activatesetpwd'        => _ADM_SKPRT_ACTIVATESETPWD,
            'addnewlog'             => _ADM_SKPRT_ADDNEWLOG,
            'adminerrorpage'        => _ADM_SKPRT_ADMINERRORPAGE,
            'adminskinoverview'     => _ADM_SKPRT_ADMINSKINOVERVIEW,
            'backuprestore'         => _ADM_SKPRT_BACKUPRESTORE,
            'banlistdeleteconfirm'  => _ADM_SKPRT_BANLISTDELETECONFIRM,
            'batchcategory'         => _ADM_SKPRT_BATCHCATEGORY,
            'batchcomment'          => _ADM_SKPRT_BATCHCOMMENT,
            'batchdelete'           => _ADM_SKPRT_BATCHDELETE,
            'batchitem'             => _ADM_SKPRT_BATCHITEM,
            'batchmember'           => _ADM_SKPRT_BATCHMEMBER,
            'batchmove'             => _ADM_SKPRT_BATCHMOVE,
            'batchteam'             => _ADM_SKPRT_BATCHTEAM,
            'blogselectbox'         => _ADM_SKPRT_BLOGSELECTBOX,
            'skinieimport'          => _ADM_SKPRT_SKINIEIMPORT,
            'insertpluginoptions'   => _ADM_SKPRT_INSERTPLUGINO,
            'pagefoot'              => _ADM_SKPRT_PAGEFOOT,
            'adminskindelete'       => _ADM_SKPRT_ADMINSKINDELETE,
            'adminskinedittype'     => _ADM_SKPRT_ADMINSKINEDITTYPE,
            'adminskiniedoimport'   => _ADM_SKPRT_ADMINSKINIEDOIMPORT,
            'adminskinieimport'     => _ADM_SKPRT_ADMINSKINIEIMPORT,
            'adminskinieoverview'   => _ADM_SKPRT_ADMINSKINIEOVERVIEW,
            'admintemplateoverview' => _ADM_SKPRT_ADMINTEMPLATEOVERVIEW,
            'adminskinremovetype'   => _ADM_SKPRT_ADMINSKINREMOVETYPE,
            'admintemplateedit'     => _ADM_SKPRT_ADMINTEMPLATEEDIT,
            'admintemplatedelete'   => _ADM_SKPRT_ADMINTEMPLATEDELETE,
        );
    }

    /**
     * static: returns an array of friendly names
     */
    static public function getFriendlyNames()
    {
        $mainTypes = self::getAdminskinDefaultTypes();
        $skintypes = self::getAdminskinDefaultTypeFriendlyNames();
        $query     = "SELECT stype FROM " . sql_table('adminskin') . " WHERE stype NOT IN ('%s')";
        $resource  = sql_query(sprintf($query, implode("', '", $mainTypes)));
        while ($row = sql_fetch_array($resource)) {
            $skintypes[strtolower($row['stype'])] = htmlspecialchars($row['stype'], ENT_QUOTES);
        }
        return $skintypes;
    }

    public function getAllowedActionsForType($type = '')
    {
        global $blogid;
        // some actions that can be performed at any time, from anywhere
        $defaultActions = array(
            'text', 'if', 'ifnot', 'else', 'elseif', 'elseifnot', 'endif',
            'addtickettourl', 'headmessage', 'ticket', 'sprinttext', 'helplink',
            'customhelplink', 'adminurl',
            /*'otherblog',    'plugin',           'version',             'nucleusbutton',
            'include',      'phpinclude',       'parsedinclude',       'loginform',
            'sitevar',      'otherarchivelist', 'otherarchivedaylist', 'otherarchiveyearlist',
            'self',                 'todaylink',           'archivelink',
            'member',       'category',         'searchform',          'referer',
            'skinname',     'skinfile',         'set',                 
                                           
               'charset',          'bloglist',            'addlink',
            'addpopupcode', 'sticky',
            'actionloglist',        'activationtitle',             'adminbatchaction',
            'adminbatchlist',       'adminbanlist',        'adminbloglink',         'adminerrormesg',
            'allowedskinactions',   'batchmovetitle',      'batchmovetype',         'batchmovelist',
            'batchmovebtn',         'batchdeletelist',     'batchdeletetype',       'blogcatlist',
            'blognotifysetting',    'blogselectbox',       'blogsettingyesno',      'blogteamlist',
            'blogteammembers',      'blogtime',            'bookmarkletadmin',      'categorysetting',
            'commentnavlist',       'configsettingsedit',  'configsettingsyesno',   'date',
            'defblogselect',        'defcatselect',        'defskinselect',         'deletecomment',
            'deleteitemid',         'deleteitembody',      'deleteitemtitle',       'editcomment',
            'editdesturl',          'editmemberlist',      'editmember',            'editskin',
            'editskintype',         'edittemplateinfo',    'editpluginfo',          'editplugoptionslist',
            'extrahead',            'eventformextra',      'getblogsetting',        'geteditpluginfo',
                                'helpplugname',          'ilistaddnew',
            'importskininfo',       'inputyesno',          'insertpluginoptions',   'iprangeinput',
            'itemnavlist',          'jstoolbaroptions',    'languageselectoptions', 'listplugplugpptionrow',
            'mediadirwarning',      'movedistselect',      'moveitemid',            'newmemberselect',
            'newestcompare',        'newpluginlist',       'outputspecialdirs',     'passrequestvars',
            'pluginhelp',           'pluginlistlist',      'pluginextras',          'pluginoptions',
            'qmenuaddselect',       'quickmenu',           'requestblogid',         'requestiprange',
            'selectlocalskinfiles', 'skineditallowedlist', 'skinielist',            'skinoverview',
            'skintypehelp',         'specialskinlist',                'systemsettings',
                            'templateoverview',                   'versioncheckurl', 
            'yrbloglist',*/
        );

        // extra actions specific for a certain skin type
        $extraActions = array();

        switch ($type) {
            case 'actionlog':
                $extraActions = array(
                                    'actionloglist',
                                );
                break;
            case 'activate':
                $extraActions = array(
                                    'activationmessage',
                                    'eventformextra',
                                );
                break;
            case 'activatesetpwd':
                $extraActions = array(
                                );
                break;
            case 'addnewlog':
                $extraActions = array(
                                    'getblogsetting',
                                    'blogsetting',
                                    'requestblogid',
                                );
                break;
            case 'adminerrorpage':
                $extraActions = array(
                                );
                break;
            case 'adminskindelete':
                $extraActions = array(
                                    'editadminskintype',
                                );
                break;
            case 'adminskinedit':
                $extraActions = array(
                                    'editadminskin',
                                    'defaultadminskintypes',
                                    'adminspecialskinlist',
                                );
                break;
            case 'adminskinedittype':
                $extraActions = array(
                                    'editadminskintype',
                                    'skintypehelp',
                                    'allowedadminskinactions',
                                    'adminskineditallowedlist',
                                );
                break;
            case 'adminskiniedoimport':
                $extraActions = array(
                                    'importskininfo',
                                );
                break;
            case 'adminskinieimport':
                $extraActions = array(
                                    'importskininfo',
                                );
                break;
            case 'adminskinieoverview':
                $extraActions = array(
                                    'selectlocaladminskinfiles',
                                    'adminskinielist',
                                );
                break;
            case 'adminskinoverview':
                $extraActions = array(
                                    'adminskinoverview',
                                );
                break;
            case 'adminskinremovetype':
                $extraActions = array(
                                    'editadminskintype',
                                );
                break;
            case 'admintemplateedit':
                $extraActions = array(
                                    'editadmintemplateinfo',
                                );
                break;
            case 'admintemplateoverview':
                $extraActions = array(
                                    'admintemplateoverview',
                                );
                break;
            case 'backupoverview':
                $extraActions = array(
                                );
                break;
            case 'backuprestore':
                $extraActions = array(
                                );
                break;
            case 'banlist':
                $extraActions = array(
                                    'adminbloglink',
                                    'adminbanlist',
                                    'requestblogid',
                                );
                break;
            case 'banlistdelete':
                $extraActions = array(
                                    'requestiprange',
                                    'requestblogid',
                                );
                break;
            case 'banlistdeleteconfirm':
                $extraActions = array(
                                    'banlistdeletedlist',
                                    'requestblogid',
                                );
                break;
            case 'banlistnew':
                $extraActions = array(
                                    'iprangeinput',
                                    'requestblogid',
                                    'blogsetting',
                                );
                break;
            case 'batchcategory':
                $extraActions = array(
                                    'adminbatchaction',
                                    'adminbatchlist',
                                );
                break;
            case 'batchcomment':
                $extraActions = array(
                                    'adminbatchaction',
                                    'adminbatchlist',
                                );
                break;
            case 'batchdelete':
                $extraActions = array(
                                    'batchdeletetype',
                                    'batchdeletelist',
                                );
                break;
            case 'batchitem':
                $extraActions = array(
                                    'adminbatchaction',
                                    'adminbatchlist',
                                );
                break;
            case 'batchmember':
                $extraActions = array(
                                    'adminbatchaction',
                                    'adminbatchlist',
                                );
                break;
            case 'batchmove':
                $extraActions = array(
                                    'batchmovetitle',
                                    'batchmovetype',
                                    'batchmovelist',
                                    'movedistselect',
                                    'batchmovebtn',
                                );
                break;
            case 'batchteam':
                $extraActions = array(
                                    'requestblogid',
                                    'adminbatchaction',
                                    'adminbatchlist',
                                );
                break;
            case 'blogcommentlist':
                $extraActions = array(
                                    'adminbloglink',
                                    'commentnavlist',
                                    'adminbatchlist',
                                );
                break;
            case 'blogselectbox':
                $extraActions = array(
                                    'blogselectbox',
                                );
                break;
            case 'blogsettings':
                $extraActions = array(
                                    'adminbloglink',
                                    'blogteammembers',
                                    'requestblogid',
                                    'blogsetting',
                                    'blognotifysetting',
                                    'defcatselect',
                                    'blogtime',
                                    'blogsettingyesno',
                                    'pluginoptions',
                                    'blogcatlist',
                                    'pluginextras',
                                );
                break;
            case 'bookmarklet':
                $extraActions = array(
                                    'bookmarkletadmin',
                                );
                break;
            case 'browseowncomments':
                $extraActions = array(
                                    'commentnavlist',
                                );
                break;
            case 'browseownitems':
                $extraActions = array(
                                    'itemnavlist',
                                );
                break;
            case 'categorydelete':
                $extraActions = array(
                                    'categorysetting',
                                    'requestblogid',
                                );
                break;
            case 'categoryedit':
                $extraActions = array(
                                    'requestblogid',
                                    'categorysetting',
                                    'editdesturl',
                                );
                break;
            case 'commentdelete':
                $extraActions = array(
                                    'deletecomment',
                                );
                break;
            case 'commentedit':
                $extraActions = array(
                                    'editcomment',
                                );
                break;
            case 'createitem':
                $extraActions = array(
                                    'adminbloglink',
                                    'ifautosave',
                                    'blogid',
                                    'jsinput',
                                    'jsbuttonbar',
                                    'contents',
                                    'ifblogsetting',
                                    'categories',
                                    'currenttime',
                                    'pluginextras',
                                    'itemoptions',
                                );
                break;
            case 'createnewlog':
                $extraActions = array(
                                    'defskinselect',
                                    'blogtime',
                                );
                break;
            case 'deleteblog':
                $extraActions = array(
                                    'blogsetting',
                                    'requestblogid',
                                );
                break;
            case 'editmembersettings':
                $extraActions = array(
                                    'editmember',
                                    'languageselectoptions',
                                    'adminskinselectoptions',
                                    'pluginoptions',
                                );
                break;
            case 'insertpluginoptions':
                $extraActions = array(
                                    'insertpluginoptions',
                                );
                break;
            case 'itemcommentlist':
                $extraActions = array(
                                    'requestblogid',
                                    'commentnavlist',
                                );
                break;
            case 'itemdelete':
                $extraActions = array(
                                    'deleteitemtitle',
                                    'deleteitembody',
                                    'deleteitemid',
                                );
                break;
            case 'itemedit':
                $extraActions = array(
                                    'init',
                                    'ifautosave',
                                    'contents',
                                    'jsinput',
                                    'jsbuttonbar',
                                    'ifblogsetting',
                                    'checkedonval',
                                    'categories',
                                    'ifitemproperty',
                                    'currenttime',
                                    'itemtime',
                                    'pluginextras',
                                    'itemoptions',
                                );
                break;
            case 'itemlist':
                $extraActions = array(
                                    'adminbloglink',
                                    'ilistaddnew',
                                    'itemnavlist',
                                );
                break;
            case 'itemmove':
                $extraActions = array(
                                    'moveitemid',
                                    'movedistselect',
                                );
                break;
            case 'manage':
                $extraActions = array(
                                );
                break;
            case 'manageteam':
                $extraActions = array(
                                    'requestblogid',
                                    'blogsetting',
                                    'blogteamlist',
                                    'newmemberselect',
                                    'inputyesno',
                                );
                break;
            case 'memberdelete':
                $extraActions = array(
                                    'editmember',
                                );
                break;
            case 'overview':
                $extraActions = array(
                                    'yrbloglist',
                                );
                break;
            case 'pagefoot':
                $extraActions = array(
                                    'date',
                                    'qmenuaddselect',
                                    'member',
                                    'quickmenu',
                                );
                break;
            case 'pagehead':
                $extraActions = array(
                                    'charset',
                                    'sitevar',
                                    'adminstyleseets',
                                    'adminurl',
                                    'extrahead',
                                    'member',
                                    'versioncheckurl',
                                    'version',
                                    'codename',
                                    'newestcompare',
                                );
                break;
            case 'plugindelete':
                $extraActions = array(
                                    'editpluginfo',
                                );
                break;
            case 'pluginhelp':
                $extraActions = array(
                                    'helpplugname',
                                    'pluginhelp',
                                );
                break;
            case 'pluginlist':
                $extraActions = array(
                                    'pluginlistlist',
                                    'newpluginlist',
                                );
                break;
            case 'pluginoptions':
                $extraActions = array(
                                    'editpluginfo',
                                    'editplugoptionslist',
                                );
                break;
            case 'settingsedit':
                $extraActions = array(
                                    'defblogselect',
                                    'defskinselect',
                                    'configsettingsedit',
                                    'languageselectoptions',
                                    'configsettingsyesno',
                                    'outputspecialdirs',
                                    'jstoolbaroptions',
                                    'adminstyleselectoptions',
                                    'mediadirwarning',
                                    'pluginextras',
                                );
                break;
            case 'showlogin':
                $extraActions = array(
                                    'passrequestvars',
                                    'adminstyleseets',
                                );
                break;
            case 'skindelete':
                $extraActions = array(
                                    'editskintype',
                                );
                break;
            case 'skinedit':
                $extraActions = array(
                                    'editskin',
                                    'specialskinlist',
                                );
                break;
            case 'skinedittype':
                $extraActions = array(
                                    'editskintype',
                                    'skintypehelp',
                                    'allowedskinactions',
                                    'skineditallowedlist',
                                    'skineditallowedlist',
                                );
                break;
            case 'skiniedoimport':
                $extraActions = array(
                                    'importskininfo',
                                );
                break;
            case 'skinieimport':
                $extraActions = array(
                                    'importskininfo',
                                );
                break;
            case 'skinieoverview':
                $extraActions = array(
                                    'selectlocalskinfiles',
                                    'skinielist',
                                );
                break;
            case 'skinoverview':
                $extraActions = array(
                                    'skinoverview',
                                );
                break;
            case 'skinremovetype':
                $extraActions = array(
                                    'editskintype',
                                );
                break;
            case 'systemoverview':
                $extraActions = array(
                                    'systemsettings',
                                );
                break;
            case 'teamdelete':
                $extraActions = array(
                                    'editmember',
                                    'blogsetting',
                                    'requestblogid',
                                );
                break;
            case 'templatedelete':
                $extraActions = array(
                                    'edittemplateinfo',
                                );
                break;
            case 'templateedit':
                $extraActions = array(
                                    'edittemplateinfo',
                                );
                break;
            case 'templateoverview':
                $extraActions = array(
                                    'templateoverview',
                                );
                break;
            case 'usermanagement':
                $extraActions = array(
                                    'editmemberlist',
                                    'inputyesno',
                                );
                break;
            case 'importAdmin':
                $extraActions = array(
                                    'charset',
                                    'sitevar',
                                    'adminstyleseets',
                                    'adminurl',
                                    'extrahead',
                                    'member',
                                    'versioncheckurl',
                                    'version',
                                    'codename',
                                    'newestcompare',
                                    'selectlocaladminskinfiles',
                                    'adminskinielist',
                                );
                break;
            default:
                if ($blogid && $blogid > 0) {
                    $extraActions = array(
                    );
                }
                break;
        }


        return array_merge($defaultActions, $extraActions);
    }

}








































?>
